/** @file bsp_key.h
*   @brief
*   @par
*   COPYRIGHT: (c)
*/
#ifndef __BSP_KEY_H
#define __BSP_KEY_H

#include "stm32f4xx_hal.h"

typedef enum{
    KEY_IDLE,
    KEY_CHECK,
    KEY_SHORT_PRESS,
    KEY_CHECK_DOUBLE_PRESS,
    KEY_DOUBLE_PRESS,
    KEY_CHECK_LONG_PRESS,
    KEY_LONG_PRESS
}KeyStatus;

typedef enum{
    DOWN,
    UP
}KeyPressStatus;

typedef struct{
    GPIO_TypeDef * gpioPort;
    uint16_t       gpioPin;
    KeyPressStatus keyPressStatus;
}KeyInformation;

typedef struct{
    GPIO_PinState (*pfReadKeyPin)(GPIO_TypeDef * gpioPort, uint16_t gpioPin);
    uint32_t      (*pfGetSystemTick)();
    KeyInformation keyInfor;
}KeyOperation;

/* @name
*  @brief
*  @parameter
*  @return
*/
KeyStatus GetKeyStatus (KeyOperation * key);

#endif
